package com.smt.ejb3.tutoria.namedquery;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Version;

@Entity
@NamedQueries({
	@NamedQuery(
			name = "findStudentByName",
			query = "FROM Student1 s WHERE s.name = :name"
	),
	@NamedQuery(
			name = "findStudentByName2",
			query = "FROM Student1 s WHERE s.name = ?"
	),
	@NamedQuery(
			name = "findAllStudents",
			query = "SELECT s FROM Student1 s"
	)})
public class Student1 implements Serializable {

	private static final long serialVersionUID = 1L;
	
	private int id;
	private int version;
	private String name;
	private int age;
	private String address;
	
	@Id
	@Column(name="STUDENT_ID")
	@GeneratedValue(strategy=GenerationType.AUTO)
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	
	@Version
	public int getVersion() {
		return version;
	}
	public void setVersion(int version) {
		this.version = version;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	
}
